package com.li.suanfa;

import java.util.Arrays;

/**  
* 类说明   
*  
* @author ****  
* @date 2018年4月1日  新建  
*/
public class SLType {
	Data[] datas;
	int len;
	int MaxSize = 10;
	
	public SLType(int size){
		datas = new Data[size];
		len = 0;
		MaxSize = size;
	}
	
	public SLType(){
		datas = new Data[MaxSize];
		len = 0;
	}
	
	static class Data{
		String key;
		String value;
		Data(String key,String value){
			this.key = key;
			this.value = value;
		}
		@Override
		public String toString() {
			return "Data [key=" + key + ", value=" + value + "]";
		}
	}
	
	
	@Override
	public String toString() {
		return "SLType [datas=" + Arrays.toString(datas) + "]";
	}

	public void addData(Data data){
		if(len < MaxSize){
			datas[len] = data;
			len++;
		}else{
			MaxSize += 10;
			Data [] datas2 = new Data[MaxSize];
			System.arraycopy(datas, 0, datas2, 0, len);
			datas = datas2;
			datas[len] = data;
			len++;
		}
	}
	
	public static void main(String[] args) {
		SLType sl = new SLType();
		for(int i=0;i<15;i++){
			sl.addData(new Data(i+"",i+""));
		}
		System.out.println(sl);
	}
}
  